﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace HeresyManager.Traits
{
    [Serializable]
    public class SkillAtArms : Trait
    {
        public override string Name
        {
            get { return "Skill at Arms"; }
        }

        Talent[] skills;


        public override IEnumerator<Comunication.Comunicator> Accire(Character c)
        {
            List<Talent> list = new List<Talent>();
            var e = base.Accire(c);
            while (e.MoveNext())
                yield return e.Current;

            var com = new Comunication.ChooseOne<Talent>("Basic Weapon Training", new Talents.WeaponTraining.BasicWeaponTrainingLas(), new Talents.WeaponTraining.BasicWeaponTrainingSP());
            while (com.SelectedValue == null)
                yield return com;
            list.Add(com.SelectedValue);
            list.Add(new Talents.WeaponTraining.MeleeWeaponTrainingPrimitive());
            com = new Comunication.ChooseOne<Talent>("Pistol Training", new Talents.WeaponTraining.PistolTrainingLas(), new Talents.WeaponTraining.PistolTrainingSP());
            while (com.SelectedValue == null)
                yield return com;
            list.Add(com.SelectedValue);


            foreach (var s in skills)
            {
                e = c.AddTalent(s, this);
                while (e.MoveNext())
                    yield return e.Current;
            }
        }

        public override void DeAccire(Character c)
        {
            base.DeAccire(c);
            foreach (var s in skills)
            {
                c.RemoveTalent(s, this);
            }
        }
    }
}
